import { createRouter, createWebHistory } from 'vue-router'
import LoginView from '@/views/login/index.vue'
import HomeView from '@/views/home/index.vue'
import ShouView from '@/views/home/shou.vue'
import FenView from '@/views/home/fen.vue'
import CeatView from '@/views/home/ceat.vue'
import MyView from '@/views/home/my.vue'
import OrderView from '@/views/order/index.vue'
import MyOrderView from '@/views/myOrder/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    // 重定向
    { path: '/', redirect: '/home/shou' },
    {
      path: '/login',
      component: LoginView,
    },
    {
      path: '/order',
      component: OrderView,
    },
    {
      path: '/myOrder',
      component: MyOrderView,
    },
    {
      path: '/home',
      component: HomeView,
      children: [
        {
          path: 'shou',
          component: ShouView,
        },
        {
          path: 'fen',
          component: FenView,
        },
        {
          path: 'ceat',
          component: CeatView,
        },
        {
          path: 'my',
          component: MyView,
        },
      ]
    },
  ],
})

export default router
